//
//  HYStatusBottomView.swift
//  iOSWeibo
//
//  Created by why on 16/7/29.
//  Copyright © 2016年 王浩宇. All rights reserved.
//

import UIKit

class HYStatusBottomView: UIView {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    private func setupUI() {
        // 添加子控件
        self.addSubview(retweetButton)
        self.addSubview(commentButton)
        self.addSubview(likeButton)
        self.addSubview(separatorViewFirst)
        self.addSubview(separatorViewSecond)
        
        // 添加约束
        /// 转发
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }
        
        /// 评论
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retweetButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }
        
        /// 赞
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            make.width.equalTo(commentButton)
        }
        
        /// 竖线1
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(retweetButton.snp_trailing)
            make.centerY.equalTo(retweetButton)
        }
        
        /// 竖线2
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
    }
    
    // MARK: - 懒加载
    /// 转发
    private lazy var retweetButton: UIButton = UIButton(imageName: "timeline_icon_retweet", title: "转发")
    
    /// 评论
    private lazy var commentButton: UIButton = UIButton(imageName: "timeline_icon_comment", title: "评论")
    
    /// 赞
    private lazy var likeButton: UIButton = UIButton(imageName: "timeline_icon_unlike", title: "赞")
    
    /// 竖线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    /// 竖线2
    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
}
